<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>服务系统后台</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<?php echo CSS_DIR ?>/adminbasic.css" />
</head>
<body>
<div id="header">
	<div>
		<div id="innerHeader">
			<div id="topguide">
				<ul id="topguide-entry">
					<li id="Admin" onmouseover="showguide(this.id);">
						<a style="cursor:pointer" href="#" onclick="return initguide('Admin');">常用功能</a>
					</li>
					<li id="AdminMarket" onmouseover="showguide(this.id);">
						<a style="cursor:pointer" href="#" onclick="return initguide('AdminMarket');">市场部管理</a>
					</li>
					<li id="AdminWork" onmouseover="showguide(this.id);">
						<a style="cursor:pointer" href="#" onclick="return initguide('AdminWork');">人力部管理</a>
					</li>
					<li id="AdminFinancial" onmouseover="showguide(this.id);">
						<a style="cursor:pointer" href="#" onclick="return initguide('AdminFinancial');">财务部管理</a>
					</li>
					<li id="AdminProperty" onmouseover="showguide(this.id);">
						<a style="cursor:pointer" href="#" onclick="return initguide('AdminProperty');">综合物业管理</a>
					</li>
					<li id="user" onmouseover="showguide(this.id);">
						<a style="cursor:pointer" href="#" onclick="return initguide('user');">用户管理</a>
					</li>
					<li id="roles" onmouseover="showguide(this.id);">
						<a style="cursor:pointer" href="#" onclick="return initguide('roles');">权限管理</a>
					</li>
				</ul>
			</div>
		</div><?php //dump($_SESSION)?>
		<div class="c"></div>
		<div id="guide"></div>
	</div>
</div>
<div id="selector">
	<div id="left" class="inner">
	</div>
</div>
<div id="gird">
	<div class="inner">
		<iframe name="main" frameborder="0" style="height:100%;visibility:inherit;width:99.99%;z-index:1"></iframe>
	</div>
</div>
<div id="footer">
  <div id="innerFooter"></div>
</div>
<div id="menu" style="display:none"></div>
<div id="showmenu" style="display:none"></div>
<script language="JavaScript">
var agt = navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_gecko = (navigator.product == "Gecko");
var guides = {
	'Admin' : {
		'common':{
			'newsAll' : ['文章管理', 'newsAll'],
			'newsNew' : ['发布文章', 'newsNew'],
			'adminAll' : ['所有管理员', 'adminAll'],
			'adminModify' : ['修改密码', 'adminModify']
		}
	},
	'AdminMarket' : {
		'teachers' : {
			'officialTeachersList' : ['正式教员', 'officialTeachersList'],
			'unVerifyTeachersList' : ['待审教员', 'unVerifyTeachersList'],
			'verifyFailTeachersList' : ['审核失败', 'verifyFailTeachersList'],
			'blacklistTeachersList' : ['黑名单', 'blacklistTeachersList']
		},
		'householder' : {
			'listHouseholders' : ['家长列表', 'listTeachers'],
			'familyEduManager' : ['家教业务管理', 'listFamilyEdus']
		},
		'article_shichang' : {
			'listArticles' : ['文章列表', 'listArticles'],
			'writeArticles' : ['发布文章', 'writeArticles']
		}
	},
	'AdminWork' : {
		'workers' : {
			'listWorkers' : ['所有员工', 'listWorkers'],
			'unrealWorkers' : ['待审员工', 'unrealWorkers'],
			'testWorkers' : ['进入试用', 'testWorkers'],
			'realWorkers' : ['正式员工', 'realWorkers'],
			'notWorkers' : ['已辞职', 'notWorkers'],
			'failWorkers' : ['审核失败', 'failWorkers'],
			'blackWorkers' : ['黑名单', 'blackWorkers'],
			'searchWorkers' : ['搜索员工', 'searchWorkers']
		}
	},
	'AdminFinancial' : {
		'financial' : {
			'importWage' : ['工资导入', 'importWage'],
			'searchWages' : ['工资查询', 'searchWages']
		}
	},
	'AdminProperty' : {
		'lostProperty' : {
			'lostPropertyList' : ['失物列表', 'lostPropertyList'],
			'lostPropertyAdd' : ['失物登记', 'lostPropertyAdd']
		}
	},
	'notice' : {
		'notice' : {
			'noticeAll' : ['所有公告', 'noticeAll'],
			'noticeNew' : ['添加公告', 'noticeNew']
		}
	},
	'user' : {
		'user' : {
			'userAll' : ['所有用户', 'userAll'],
			'userNew' : ['添加用户', 'userNew']
		},
		'admin' : {
			'adminAll' : ['所有管理员', 'adminAll'],
			'adminNew' : ['添加管理员', 'adminNew']
		}
	},
	'roles' : {
		'roles' : {
			'allRoles' : ['权限管理', 'rolesManager']
		}
	}
}

var titles = {
	'common' : '常用功能',
	'notice' : '公告管理',
	'user' : '用户管理',
	'householder' : '家教兼职管理',
	'article_shichang':'文章管理',
	'admin' : '管理员管理',
	'teachers' : '教员管理',
	'workers' : '员工管理',
	'financial' : '工资管理',
	'lostProperty' : '综合物业',
	'power' : '权限管理'
}

var cate   = 'Admin';
var action = '';
var type   = '';

function uptopguide(id){
	var obj  = document.getElementById('topguide-entry');
	var objs = obj.getElementsByTagName('li');
	for(var i=0;i<objs.length;i++){
		objs[i].className = objs[i].id==id ? 'li1' : '';
	}
}
function upleft(t){
	var obj  = document.getElementById('left');
	var objs = obj.getElementsByTagName('a');
	for(var i=0;i<objs.length;i++){
		objs[i].className = objs[i].id==t ? 'a1' : '';
	}
}
function showguide(id){

	var obj = document.getElementById('showmenu');

	var guide = guides[id];
	var html  = '<dl>';

	for(i in guide){
		var subs = guide[i];
		html += '<dd>';
		for(j in subs){
			var sub = subs[j];
			html += '<a href="#" onclick="return initguide(\''+id+'\',\''+j+'\')">'+sub[0]+'</a>';
		}
		html += '</dd>';
	}
	obj.innerHTML = html + '</dl>';

	var obj1  = document.getElementById(id);
	var left  = findPosX(obj1);
	var top   = findPosY(obj1) + 22;

	obj.style.display = "";
	obj.style.top	= top + 'px';
	obj.style.left	= left + 'px';

	addEvent(document,"mouseout",doc_mouseout);
}
function closeguide(){
	var obj = document.getElementById('showmenu');
	obj.style.display = "none";
	uptopguide(cate);
	removeEvent(document,"mouseout",doc_mouseout);
}
function showleft(id,t,url){
	cate = id;
	var obj = document.getElementById('left');

	var html = '<dl>';
	var guide = guides[id];

	url = typeof url != 'undefined' ? url : '';
	type = typeof t != 'undefined' ? t : '';

	for(i in guide){
		var subs = guide[i];
		html += '<dt>' + titles[i] + '</dt><dd>';
		for(j in subs){
			var sub = subs[j];
			html += '<a id="'+j+'" href="#" onclick="return initguide(\''+id +'\',\''+j+'\')">'+sub[0]+'</a>';
			if(url == ''){
				if(type == ''){
					url = sub[1];
					type = j;
				} else if(j == type){
					url = sub[1];
				}
				action = i;
			}
		}
		html += '</dd>';
	}
	obj.innerHTML = html + '</dl>';
	uptopguide(cate);
	upleft(type);
	parent.main.location = '<?php echo ROOT ?>/index.php/'+id+'/'+url;
	return false;
}
function showtitle(){
	var obj = document.getElementById('guide');
	var guide = guides[cate];
	var html = '<span class="fr s1" style="margin:0 16px">用户: <?php echo $user['username'] ?> |　<a class="s0" href="<?php echo url() ?>" target="_blank">网站首页</a> <a class="s0" href="<?php echo url('admin', 'adminModify') ?>">修改密码</a>　<a class="s0" href="<?php echo url('user', 'logout') ?>">注销</a></span>';
	if(action && type){
		html += '<h1>' + titles[action] + ' &raquo; ' + guide[action][type][0] + '</h1>';
	} else {
		html += '<h1>淘车后台首页</h1>';
	}
	obj.innerHTML = html;
}
function initguide(id,t,url){
	showleft(id,t,url);
	showtitle();
	return false;
}
function showmenu(){
	var obj = document.getElementById('menu');
	top.main.showselect('hidden');
	if(!IsElement('menubg')){
		var html = '<div id="menu2" class="inner">';
		for(i in guides){
			if(i=='common') continue;
			var guide = guides[i];
			html += "<dl>";
			for(j in guide){
				html += "<dt><h3>" + titles[j] + "</h3></dt><dd>";
				var subs = guide[j];
				for(k in subs){
					var sub = subs[k];
					html += '<a href="#" onclick="return toguide(\''+i+'\',\''+k+'\')">'+sub[0]+'</a>';
				}
				html += "</dd>";
			}
			html += '</dl>';
		}
		html += '<div><a class="fr" style="color:#ff8800; position:absolute;right:1%;top:1%; cursor:pointer;" onclick="closemenu();">关闭</a></div></div>';
		obj.innerHTML = html;
		var obj2 = document.createElement("div");
		obj2.id = "menubg";
		obj.parentNode.insertBefore(obj2,obj);
	} else {
		var obj2 = document.getElementById('menubg');
		obj2.style.display = "";
	}
	obj.style.display = "";
	addEvent(document,"mousedown",doc_mousedown);
}
function closemenu(){
	var obj = document.getElementById('menu');
	obj.style.display = "none";
	var obj2 = document.getElementById('menubg');
	obj2.style.display = "none";
	removeEvent(document,"mousedown",doc_mousedown);
	top.main.showselect('');
}
function toguide(id,t){
	closemenu();
	initguide(id,t);
	return false;
}
function doc_mousedown(e){
	var e = is_ie ? event: e;
	obj	= document.getElementById("menu");
	_x	= is_ie ? e.x : e.pageX;
	_y	= is_ie ? e.y + ietruebody().scrollTop : e.pageY;
	_x1 = obj.offsetleft;
	_x2 = obj.offsetleft + obj.offsetWidth;
	_y1 = obj.offsetTop - 20;
	_y2 = obj.offsetTop + obj.offsetHeight;

	if(_x<_x1 || _x>_x2 || _y<_y1 || _y>_y2){
	   closemenu();
	}
}
function doc_mouseout(e){
	var e = is_ie ? event: e;
	obj	= document.getElementById("showmenu");
	_x	= is_ie ? e.x : e.pageX;
	_y	= is_ie ? e.y : e.pageY;
	_x1 = obj.offsetLeft + 2;
	_x2 = obj.offsetLeft + obj.offsetWidth;
	_y1 = obj.offsetTop - 20;
	_y2 = obj.offsetTop + obj.offsetHeight;

	if(_x<_x1 || _x>_x2 || _y<_y1 || _y>_y2){
		closeguide();
	}
}
function IsElement(id){
	return document.getElementById(id)!=null ? true : false;
}
function addEvent(el,evname,func){
	if(is_ie){
		el.attachEvent("on" + evname,func);
	} else{
		el.addEventListener(evname,func,true);
	}
};
function removeEvent(el,evname,func){
	if(is_ie){
		el.detachEvent("on" + evname,func);
	} else{
		el.removeEventListener(evname,func,true);
	}
};
function findPosX(obj){
	var curleft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) {
		curleft += obj.x;
	}
	return curleft;
}
function findPosY(obj){
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	} else if (obj.y){
		curtop += obj.y;
	}
	return curtop;
}
function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
initguide(cate,type,'main');
</script>
</body>
</html>